From c910b98ba4f26cdf07b13d190e63826c85b617be Mon Sep 17 00:00:00 2001 From: Debian LibreOffice Maintainers Date: Wed, 28 Jan 2026 21:03:25 +0100 Subject: [PATCH] pdfium-ports Gbp-Pq: Name pdfium-ports.diff --- ...ics-Fix-incorrect-preprocessor-check.patch | 50 +++++++++++++++++++ external/pdfium/UnpackedTarball_pdfium.mk | 3 ++ external/pdfium/debian-ports.diff | 28 +++++++++++ 3 files changed, 81 insertions(+) create mode 100644 external/pdfium/0001-core-fxcrt-numerics-Fix-incorrect-preprocessor-check.patch create mode 100644 external/pdfium/debian-ports.diff diff --git a/external/pdfium/0001-core-fxcrt-numerics-Fix-incorrect-preprocessor-check.patch b/external/pdfium/0001-core-fxcrt-numerics-Fix-incorrect-preprocessor-check.patch new file mode 100644 index 00000000000..3f281c7c9ff --- /dev/null +++ b/external/pdfium/0001-core-fxcrt-numerics-Fix-incorrect-preprocessor-check.patch @@ -0,0 +1,50 @@ +>From 1c815bec0324037494840d01fc579f2a3420e624 Mon Sep 17 00:00:00 2001 +From: John Paul Adrian Glaubitz +Date: Thu, 27 Nov 2025 13:22:22 +0100 +Subject: [PATCH] core/fxcrt/numerics: Fix incorrect preprocessor check on + aarch64 + +The preprocessor macro to toggle the use of safe_math_arm_impl.h +currently checks whether __ARMEL__ or __arch64__ are defined. However, +on aarch64, the actual define is called __aarch64__ not __arch64__: + +(sid_arm64-dchroot)glaubitz@amdahl:~$ uname -a +Linux amdahl 6.12.57+deb13-arm64 #1 SMP Debian 6.12.57-1 (2025-11-05) aarch64 GNU/Linux +(sid_arm64-dchroot)glaubitz@amdahl:~$ echo | gcc -E -dM -|grep arch +(sid_arm64-dchroot)glaubitz@amdahl:~$ + +However, the define __arch64__ is used on sparc64: + +(sid_sparc64-dchroot)glaubitz@stadler:~$ uname -a +Linux stadler 6.17.0-rc5+ #1 SMP Fri Sep 12 20:37:32 UTC 2025 sparc64 GNU/Linux +(sid_sparc64-dchroot)glaubitz@stadler:~$ echo | gcc -E -dM -|grep arch +(sid_sparc64-dchroot)glaubitz@stadler:~$ + +This triggers the use of safe_math_arm_impl.h on sparc64 which causes +the compiler to emit the "qsub" instruction which is not recongized: + +/tmp/ccLEFgM7.s: Assembler messages: +/tmp/ccLEFgM7.s:10332: Error: Unknown opcode: `qsub' +/tmp/ccLEFgM7.s:10365: Error: Unknown opcode: `qsub' + +Signed-off-by: John Paul Adrian Glaubitz +--- + core/fxcrt/numerics/safe_math_clang_gcc_impl.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/core/fxcrt/numerics/safe_math_clang_gcc_impl.h b/core/fxcrt/numerics/safe_math_clang_gcc_impl.h +index 58419d5c9..d395ebd3e 100644 +--- core/fxcrt/numerics/safe_math_clang_gcc_impl.h ++++ core/fxcrt/numerics/safe_math_clang_gcc_impl.h +@@ -14,7 +14,7 @@ + + #include "core/fxcrt/numerics/safe_conversions.h" + +-#if defined(__ARMEL__) || defined(__arch64__) ++#if defined(__ARMEL__) + #include "core/fxcrt/numerics/safe_math_arm_impl.h" // IWYU pragma: export + #define BASE_HAS_ASSEMBLER_SAFE_MATH (1) + #else +-- +2.47.3 + diff --git a/external/pdfium/UnpackedTarball_pdfium.mk b/external/pdfium/UnpackedTarball_pdfium.mk index 2f857315ac6..424dc75e2d4 100644 --- a/external/pdfium/UnpackedTarball_pdfium.mk +++ b/external/pdfium/UnpackedTarball_pdfium.mk @@ -26,6 +26,9 @@ ifeq ($(OS),WNT) pdfium_patches += pdfium-vs2019-arm64_no-__umulh.patch.1 endif +pdfium_patches += debian-ports.diff +pdfium_patches += 0001-core-fxcrt-numerics-Fix-incorrect-preprocessor-check.patch + # TODO, attempt upstream pdfium_patches += ofz451333752.patch pdfium_patches += extractpatterns.patch diff --git a/external/pdfium/debian-ports.diff b/external/pdfium/debian-ports.diff new file mode 100644 index 00000000000..1d9b1401fbb --- /dev/null +++ b/external/pdfium/debian-ports.diff @@ -0,0 +1,28 @@ +--- build/build_config.h 2024-03-05 16:50:08.624785549 +0100 ++++ build/build_config.h 2024-03-05 16:50:55.616839071 +0100 +@@ -350,6 +350,25 @@ + #define ARCH_CPU_RISCV64 1 + #define ARCH_CPU_64_BITS 1 + #define ARCH_CPU_LITTLE_ENDIAN 1 ++#elif defined(__sparc__) ++#define ARCH_CPU_BIG_ENDIAN 1 ++#if defined(__arch64__) ++#define ARCH_CPU_64_BITS 1 ++#else ++#define ARCH_CPU_32_BITS 1 ++#endif ++#elif defined(__m68k__) ++#define ARCH_CPU_32_BITS 1 ++#define ARCH_CPU_BIG_ENDIAN 1 ++#elif defined(__hppa__) ++#define ARCH_CPU_32_BITS 1 ++#define ARCH_CPU_BIG_ENDIAN 1 ++#elif defined(__alpha__) ++#define ARCH_CPU_64_BITS 1 ++#define ARCH_CPU_LITTLE_ENDIAN 1 ++#elif defined(__ia64__) ++#define ARCH_CPU_64_BITS 1 ++#define ARCH_CPU_LITTLE_ENDIAN 1 + #else + #error Please add support for your architecture in build/build_config.h + #endif -- 2.30.2